package com.aspose.cells;

import java.util.ArrayList;
import java.util.Iterator;

class zamr extends zbz {
   zant a;
   int d;

   zamr(zant var1) {
      this.c(236);
      this.a = var1;
   }

   void a(byte[] var1, int var2, int var3) {
      this.d = var3;
      this.c = new byte[this.d];
      System.arraycopy(var1, var2, this.c, 0, var3);
   }

   void a() {
      this.d = 8;
      this.c = new byte[8];
      this.c[2] = 13;
      this.c[3] = -16;
   }

   void a(ShapeCollection var1) {
      zqy var2 = var1.c();
      int var3 = var2.f();
      int var4 = 48;

      int var5;
      for(var5 = 0; var5 < var1.getCount(); ++var5) {
         var4 += 48 + var1.get(var5).N().c().d();
      }

      var5 = var3 + var4;
      if (this.a != null && this.a.a != null) {
         var5 += this.a.a.length;
      }

      this.d = var5 + 8;
      this.c = new byte[this.d];
      int var6 = var2.a(this.c, 0, var5, var4);

      for(Iterator var7 = var1.iterator(); var7.hasNext(); var6 += 8) {
         Shape var8 = (Shape)var7.next();
         Picture var9 = (Picture)var8;
         this.c[var6] = 15;
         this.c[var6 + 2] = 4;
         this.c[var6 + 3] = -16;
         System.arraycopy(com.aspose.cells.b.a.zc.a(40 + var9.N().c().d()), 0, this.c, var6 + 4, 4);
         var6 += 8;
         this.c[var6] = -78;
         this.c[var6 + 1] = 4;
         this.c[var6 + 2] = 10;
         this.c[var6 + 3] = -16;
         this.c[var6 + 4] = 8;
         var6 += 8;
         System.arraycopy(com.aspose.cells.b.a.zc.a(var9.N().i().b()), 0, this.c, var6, 4);
         System.arraycopy(com.aspose.cells.b.a.zc.a(var9.N().i().c()), 0, this.c, var6 + 4, 4);
         var6 += 8;
         var6 += var9.N().c().a(var8, this.c, var6, false);
         this.c[var6 + 2] = 16;
         this.c[var6 + 3] = -16;
         this.c[var6 + 4] = 8;
         var6 += 8;
         System.arraycopy(com.aspose.cells.b.a.zc.a(var9.getWidth()), 0, this.c, var6, 4);
         System.arraycopy(com.aspose.cells.b.a.zc.a(var9.getHeight()), 0, this.c, var6 + 4, 4);
      }

      if (this.a != null && this.a.a != null) {
         System.arraycopy(this.a.a, 0, this.c, var6, this.a.a.length);
      }

   }

   int a(ShapeCollection var1, Shape var2) {
      zqy var3 = var1.c();
      int var4 = var3.f();
      this.d = var4 + 8 + 48;
      if (var1.getCount() != 0) {
         this.d += var2.T();
         if (var2.D()) {
            this.d -= 8;
         }
      }

      this.c = new byte[this.d];
      byte var5 = 0;
      int var6 = (int)(var3.e() & 4294967295L);
      int var7 = var4 + var6;
      if (this.a != null && this.a.a != null) {
         var7 += this.a.a.length;
      }

      int var8 = var3.a(this.c, var5, var7, var6);
      return var8;
   }

   void a(int var1, Shape var2) {
      byte[] var3 = new byte[]{15, 0, 4, -16, 82, 0, 0, 0, -110, 12, 10, -16, 8, 0, 0, 0, 5, 8, 0, 0, 0, 10, 0, 0, 67, 0, 11, -16, 24, 0, 0, 0, 127, 0, 4, 1, 4, 1, -65, 0, 8, 0, 8, 0, -1, 1, 0, 0, 8, 0, -65, 3, 0, 0, 2, 0, 0, 0, 16, -16, 18, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, -16, 0, 0, 0, 0};
      System.arraycopy(com.aspose.cells.b.a.zc.a(var2.N().i().b()), 0, var3, 16, 4);
      if (var1 == 0) {
         this.d = var3.length;
         this.c = var3;
      } else {
         System.arraycopy(var3, 0, this.c, var1, var3.length);
      }

   }

   void a(Shape var1, int var2, int var3, int var4, int var5) {
      if (var2 != 0) {
         this.a(var2, var1);
      } else if (this.d <= 90 && this.c != null) {
         System.arraycopy(com.aspose.cells.b.a.zc.a(var1.N().i().b()), 0, this.c, 16, 4);
      } else {
         this.a(0, var1);
      }

      var2 = this.d - 24;
      this.c[var2] = (byte)var4;
      if (var5 > 255) {
         this.c[9] = 1;
      } else {
         this.c[var2 + 8] = (byte)var5;
      }

      System.arraycopy(com.aspose.cells.b.a.zc.a(var3), 0, this.c, var2 + 4, 2);
      System.arraycopy(com.aspose.cells.b.a.zc.a((var3 & '\uffff') + 1), 0, this.c, var2 + 12, 2);
   }

   void a(Shape var1, int var2, int var3, byte var4) {
      this.a(var2, var1);
      var2 = this.d - 24;
      this.c[var2] = var4;
      this.c[var2 + 8] = (byte)((var4 & 255) + 1);
      this.c[var2 + 11] = 1;
      System.arraycopy(com.aspose.cells.b.a.zc.a(var3), 0, this.c, var2 + 4, 2);
      System.arraycopy(com.aspose.cells.b.a.zc.a(var3 + 1), 0, this.c, var2 + 12, 2);
   }

   void a(Shape var1, int var2, ArrayList var3) {
      if (this.c == null) {
         this.d = var1.T();
         if (var1.D()) {
            this.d -= 8;
         }

         this.c = new byte[this.d];
         var2 = 0;
      }

      zbol var4 = null;
      if (var1.isGroup()) {
         this.c[var2] = 15;
         this.c[var2 + 2] = 3;
         this.c[var2 + 3] = -16;
         System.arraycopy(com.aspose.cells.b.a.zc.a(((GroupShape)var1).c()), 0, this.c, var2 + 4, 4);
         var2 += 8;
         var4 = ((GroupShape)var1).a();
         com.aspose.cells.b.a.a.ze.a(var3, (Object)var4);
      }

      var2 = var1.N().a(this.c, var2, var4);
      if (var1.S()) {
         if (var1.isGroup()) {
            var4 = (zbol)var3.get(var3.size() - 2);
         } else {
            var4 = (zbol)var3.get(var3.size() - 1);
         }

         int var10000 = var2 + var1.a(this.c, var2, var4);
      } else {
         var2 += var1.a(this.c, var2);
      }

   }

   void a(zqa var1) throws Exception {
      byte[] var2 = new byte[4];
      System.arraycopy(com.aspose.cells.b.a.zc.a(this.f()), 0, var2, 0, 2);
      if (this.d < 8224) {
         System.arraycopy(com.aspose.cells.b.a.zc.a(this.d), 0, var2, 2, 2);
         var1.a(var2);
         if (this.c != null && this.c.length != 0) {
            var1.a(this.c);
         }
      } else {
         System.arraycopy(com.aspose.cells.b.a.zc.a((short)8224), 0, var2, 2, 2);
         var1.a(var2);
         var1.a(this.c, 0, 8224);
         int var3 = this.d - 8224;
         int var4 = 8224;
         System.arraycopy(com.aspose.cells.b.a.zc.a((int)60), 0, var2, 0, 2);

         while(var3 >= 8224) {
            var1.a(var2);
            var1.a(this.c, var4, 8224);
            var4 += 8224;
            var3 -= 8224;
         }

         System.arraycopy(com.aspose.cells.b.a.zc.a(var3), 0, var2, 2, 2);
         var1.a(var2);
         var1.a(this.c, var4, var3);
      }

   }
}
